<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Demo</title>
  <style>
  #paper {
    position: relative;
  }
  </style>
  <script src="https://s2.ssl.qhres.com/!87edaa34/animator-0.3.1.min.js"></script>
</head>
<body>
  <div id="container"></div>
  <script src="/js/spritejs.js"></script>
  <script>
  (async function(){
    const paper = spritejs.Paper2D('#container', 1200, 800)
    const Sprite = spritejs.Sprite,
          Label = spritejs.Label

    const s = new Sprite()

    const img = document.createElement('img')
    img.src = 'images/tt2.png'
    img.onload = function() {
      s.attr({
        textures: [{
          image: img,
          srcRect: [0, 0, 200, 200],
        }]
      })
      
      s.attr({
        bgcolor: 'grey',
        anchor: [0.5, 0.5],
        pos: [600, 400],
        zIndex: 200,
      })  

      window.s = s
      paper.layer().appendChild(s)
    }
  })()
  </script>
</body>
</html>